package com.google.android.gms.internal;

import android.content.Context;
import android.os.RemoteException;
import com.google.android.gms.ads.reward.RewardedVideoAd;
import com.google.android.gms.common.internal.Hide;
import com.google.android.gms.common.internal.zzbq;
import com.google.android.gms.dynamic.zzn;

@Hide
@zzabh
public final class zzmz {
    private static final Object sLock = new Object();
    private static zzmz zzbkd;
    private zzmh zzbke;
    private RewardedVideoAd zzbkf;

    private zzmz() {
    }

    public static zzmz zziz() {
        zzmz zzmz;
        synchronized (sLock) {
            if (zzbkd == null) {
                zzbkd = new zzmz();
            }
            zzmz = zzbkd;
        }
        return zzmz;
    }

    public final RewardedVideoAd getRewardedVideoAdInstance(Context context) {
        synchronized (sLock) {
            if (this.zzbkf != null) {
                RewardedVideoAd rewardedVideoAd = this.zzbkf;
                return rewardedVideoAd;
            }
            this.zzbkf = new zzafk(context, (zzaex) zzks.zza(context, false, new zzla(zzlc.zzik(), context, new zzwe())));
            RewardedVideoAd rewardedVideoAd2 = this.zzbkf;
            return rewardedVideoAd2;
        }
    }

    public final void openDebugMenu(Context context, String str) {
        zzbq.zza(this.zzbke != null, (Object) "MobileAds.initialize() must be called prior to opening debug menu.");
        try {
            this.zzbke.zzb(zzn.zzz(context), str);
        } catch (RemoteException e) {
            zzaky.zzb("Unable to open debug menu.", e);
        }
    }

    public final void setAppMuted(boolean z) {
        zzbq.zza(this.zzbke != null, (Object) "MobileAds.initialize() must be called prior to setting app muted state.");
        try {
            this.zzbke.setAppMuted(z);
        } catch (RemoteException e) {
            zzaky.zzb("Unable to set app mute state.", e);
        }
    }

    public final void setAppVolume(float f) {
        boolean z = false;
        zzbq.checkArgument(0.0f <= f && f <= 1.0f, "The app volume must be a value between 0 and 1 inclusive.");
        if (this.zzbke != null) {
            z = true;
        }
        zzbq.zza(z, (Object) "MobileAds.initialize() must be called prior to setting the app volume.");
        try {
            this.zzbke.setAppVolume(f);
        } catch (RemoteException e) {
            zzaky.zzb("Unable to set app volume.", e);
        }
    }

    public final void zza(Context context, String str, zznb zznb) {
        synchronized (sLock) {
            if (this.zzbke == null) {
                if (context == null) {
                    throw new IllegalArgumentException("Context cannot be null.");
                }
                try {
                    this.zzbke = (zzmh) zzks.zza(context, false, new zzkx(zzlc.zzik(), context));
                    this.zzbke.initialize();
                    if (str != null) {
                        this.zzbke.zza(str, zzn.zzz(new zzna(this, context)));
                    }
                } catch (RemoteException e) {
                    zzaky.zzc("MobileAdsSettingManager initialization failed", e);
                }
            }
        }
    }

    public final float zzdp() {
        if (this.zzbke == null) {
            return 1.0f;
        }
        try {
            return this.zzbke.zzdp();
        } catch (RemoteException e) {
            zzaky.zzb("Unable to get app volume.", e);
            return 1.0f;
        }
    }

    public final boolean zzdq() {
        if (this.zzbke == null) {
            return false;
        }
        try {
            return this.zzbke.zzdq();
        } catch (RemoteException e) {
            zzaky.zzb("Unable to get app mute state.", e);
            return false;
        }
    }
}
